﻿<html>
<body>

<script type="text/javascript" src="/static/json2.js"></script>
<script type="text/javascript">

	function OnSendMessage()
	{
	    if(1 > document.getElementById('msgsendto').value.length)
	    {
		var ItemList = document.getElementsByName("userloginname");
		var HaveSelect = false;
		for(i=0; i< ItemList.length; i++)
		{
			if(ItemList[i].checked)
			{
				HaveSelect = true;
				break;
			}
		}

		if(!HaveSelect)
		{
			alert("请输入接收人或从朋友列表中选择接收人！");
			document.getElementById('msgsendto').focus();
			return false;
		}
	    }

	    if(1 > document.getElementById('msgtitle').value.length)
	    {
		alert("请输入发送标题");
		document.getElementById('msgtitle').focus();
		return false;
	    }

	    return true;
	}

</script>



<form id="form-write-msg" action="/message_send" onsubmit="return OnSendMessage()" method="post">

<table borderColor=#cccccc cellSpacing=0 cellPadding=0 width="100%" bgColor=#ffffff border=0>
    <tr>
	<td align="left">
	    收件人（多个请以 ; 分隔）<br>
	</td>
	<td align="left">
	    <input type="text" id="msgsendto" name="msgsendto" size="70"><br>
	</td>
    </tr>

    {% if FriendInfos %}
    <tr>
	<td align="left">
		或从朋友({{ FriendInfos|length }}个)列表中选择：
	</td>
	<td align="left">
	    {% for Friend in FriendInfos %}
		<input type="checkbox" id="userloginname" name="userloginname" value="{{ Friend.LoginName }}" />{{ Friend.NickName }};&nbsp;
	    {% endfor %}
	    <br>&nbsp;
	</td>
    </tr>
    {% endif %}

    <tr>
	<td align="left">标题</td>
	<td align="left"><input type="text" id="msgtitle" name="msgtitle" size="70"></input></td>
    </tr>

    <tr>
	<td align="left">内容（不能超过200汉字）</td>
	<td align="left"><textarea id="msgcontent" name="msgcontent" rows="5" cols="60"></textarea></td>
    </tr>
</table>

<p align="center"><input type="submit" value="发送"></p>
</form>

</body>
</html>
